{extends file="./main.tpl"}
{block name=head}
<script language="javascript">
function passwordMatch()
{
  if(document.party.userpassword.value != document.party.userpasswordCom.value)
  {
    alert("Password Miss Match!!!!!");
    document.party.userpasswordCom.value="";
    document.party.userpassword.focus();
  }
}
</script>
{/block}
{block name=body}
<form name="party" action="" method="post">
<center><font color='red'><b>{$msg}</b></font></center>
<table align="center" border="0" cellpadding="2" cellspacing="2" >
<tr>
  <td align="center" class="table1" colspan="2">Create New User</td>
</tr>
<tr>
  <td class="table2" align="right">Branch</td>
  <td class="table2">
  	<select name="branchId">
  		<option value="0">Select Branch</option>
  		{html_options values=$branchArray.branchId output=$branchArray.branchName}
    </select>
  </td>
</tr>
<tr>
  <td class="table2" align="right">User Name</td>
  <td class="table2">
  	<input type="text" name="userName" id="userName" autofocus=autofocus required="required" ></td>
</tr>
<tr>
  <td class="table2" align="right">Password</td>
  <td class="table2">
  	<input type="password" name="userpassword" id="userpassword"  required="required" ></td>
</tr>
<tr>
  <td class="table2" align="right">Confirm Password</td>
  <td class="table2">
  	<input type="password" name="userpasswordCom" id="userpasswordCom" onblur="passwordMatch();"  required="required" ></td>
</tr>
<tr>
  <td class="table1" align="center" colspan="2"><input type="submit" name="userIns"  value="Create User" class="button" /></td>
</tr>
</table>
<br>
<br>
<table align="center" border="0" cellpadding="2" cellspacing="2" >
<tr>
  <td align="center" class="table1" colspan="4">
    User List
  </td>
</tr>

<tr>
	{if $s_userType eq 'user'}
	<td class="table1">User Name</td>
  {else}
  <td class="table1">User Name</td>
	<td class="table1">Password</td>
	<td class="table1">Branch Name</td>
	<td class="table1">Delete</td>
	{/if}
</tr>
{section name=user loop=$userArr}
<tr>
	{if $s_userType eq 'user'}
	<td>{$userArr[user].userName}</td>
	{else}
	<td>{$userArr[user].userName}</td>
	<td>{$userArr[user].password}</td>
	<td>{$userArr[user].branchName}</td>
	{/if}
	<td><a onClick='return confirm("R U Sure U Want To Delete");' href="list.php?userId={$userArr[user].userId}">Delete</a></td>
</tr>
{/section}
</table>	
</form>
{/block}